import logst.parsers_base as parsers_base

class errno_Parser(parsers_base.base_Parser_class):

   def initialize(self):

      self.load_hints_from_file("/usr/include/asm-generic/errno-base.h")
      self.load_hints_from_file("/usr/include/asm-generic/errno.h")

   def load_hints_from_file(self, fname):
      try:
         fp = open(fname, "r")
      except:
         return False

      for line in fp.readlines():

         #define ENOMEDIUM       123     /* No medium found */

         xline = line.split()

         if len(xline) < 3 or not ( xline[0] == "#define" and xline[1][0] == "E" ):
            continue

         self.add_hint(xline[1] , line.strip() )

      fp.close()

